from pandas import array


array = [1,8,15]
gen = (x for x in array if array.count(x)>0)
array = [2,8,22]
print(list(gen))
# 8